CC=gcc
RANLIB=ranlib

LIBSRC= uthreads.c thread.c queue.c translateAddress.c
LIBOBJ=$(LIBSRC:.c=.o)

INCS=-I.
CFLAGS = -Wall -g $(INCS)
LOADLIBES = -L./ 

OSMLIB = libuthreads.a
TARGETS = $(OSMLIB)

all: $(TARGETS) tester

$(TARGETS): $(LIBOBJ)
	$(AR) $(ARFLAGS) $@ $^
	$(RANLIB) $@

clean:
	$(RM) $(TARGETS) $(OSMLIB) $(OBJ) $(LIBOBJ) translateAddress.o thread.o queue.o *~ *core

depend:
	makedepend -- $(CFLAGS) -- $(SRC) $(LIBSRC)
	
tester: cleanOBJ tester.o
	gcc -Wall tester.o -lm -luthreads -L. -o tester
	
tester.o: Tester.c
	gcc -Wall -lm -c Tester.c -o tester.o

cleanOBJ:
	rm *.o
	
uthreads.o: uthreads.c
	gcc -Wall -lm -c uthreads.c -o uthreads.o
queue.o: queue.c
	gcc -Wall -lm -c queue.c
thread.o: thread.c
	gcc -Wall -lm -c thread.c
translateAddress.o: translateAddress.c
	gcc -Wall -lm -c translateAddress.c -o translateAddress.o
